package com.tianhui.consignortwofei.mvp.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import com.tianhui.consignortwofei.R;
import com.tianhui.consignortwofei.mvp.model.enty.AccountDetailInfo;

import org.yczbj.ycrefreshviewlib.adapter.RecyclerArrayAdapter;
import org.yczbj.ycrefreshviewlib.holder.BaseViewHolder;

/**
 * @author fgs
 * @date 2020/9/22
 * @description
 **/
public class AccountDetailAdapter extends RecyclerArrayAdapter<AccountDetailInfo> {
    public AccountDetailAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new AccountDetailViewHolder(parent, R.layout.item_account_details);
    }

    private class AccountDetailViewHolder extends BaseViewHolder<AccountDetailInfo> {

        private TextView typeTextView;
        private TextView timeTextView;
        private TextView amountTextView;

        public AccountDetailViewHolder(ViewGroup parent, int res) {
            super(parent, res);
            typeTextView = getView(R.id.item_account_details_typeTextView);
            timeTextView = getView(R.id.item_account_details_timeTextView);
            amountTextView = getView(R.id.item_account_details_amountTextView);
        }

        @Override
        public void setData(AccountDetailInfo data) {
            super.setData(data);
            typeTextView.setText(data.typetext);
            timeTextView.setText(data.create_time);
            amountTextView.setText(data.money);
        }
    }
}
